package atguigu.thread.task;

import java.util.concurrent.CompletableFuture;

public class Client {



    public static CompletableFuture<Client> connect(){
       return  CompletableFuture.supplyAsync(()->{
           try {
               System.out.println("创建一个异步任务");
               Thread.sleep(1000*6);
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
           return new Client();
       });
    }

    public String sendMsg(){
        return "msg";
    }
}
